#!/bin/bash

INSTALL_DIR=/usr/local
X264_SRC=../x264-snapshot-20160627-2245
FDKAAC_SRC_DIR=../fdk-aac-0.1.6
FFMPEG_SRC=../ffmpeg-2.8

#rm -rf $INSTALL_DIR

# build x264
cd $X264_SRC
make clean
./configure --prefix=$INSTALL_DIR \
       --enable-pic \
       --enable-shared \
       --enable-strip \
       --disable-avs \
       --disable-swscale \
       --disable-lavf \
       --disable-ffms \
       --disable-gpac \
       --disable-lsmash 

make -j8 install

echo "======================================== x264 build over  ====================================================="

cd $FDKAAC_SRC_DIR
./autogen.sh
make clean
./configure --prefix=$INSTALL_DIR --disable-static --enable-shared
make -j8 install

echo "======================================== fdk aac build over  ====================================================="

# build ffmpeg
cd $FFMPEG_SRC
make clean
./configure --prefix=$INSTALL_DIR \
--enable-runtime-cpudetect \
--extra-cflags="-fPIC -Wfatal-errors -Wno-deprecated -I$INSTALL_DIR/include"  \
--extra-ldflags="-L$INSTALL_DIR/lib" \
--enable-gpl --enable-nonfree --enable-version3 --enable-small \
--enable-shared --disable-static \
--disable-doc --disable-programs --disable-debug --disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-ffserver \
  
make -j8 install 



#
